<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>管理系统</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  
    <?php if($form_parm_arr['static_html']){ ?>
      {$form_parm_arr['static_html']|raw}
    <?php }else{ ?>
      {:widget_st('layui','css')}
      {:widget_st('admin','css')}
      {:widget_st('jq','js')}
      {:widget_st('laydate','js')}    
      {:widget_st('ueditor')}
      {:widget_st('webuploader')}
      {:widget_st('tinymce515')}
      {:widget_st('layui','js')}  
      {:widget_st('wangEditor')}
      {:widget_st('vditor')}
      {:widget_st('meditor')}
      {:widget_st('input-tag')} 
    <?php } ?> 
</head>
{:do_action('admin_head')}
<style>
  html{background-color: #fff;}
  .layui-card {box-shadow:0 0 0 0;}
  .layui-card-header{border-bottom: 0;}
  .layui-row{padding-top: 0;}
  .layui-fluid{padding-top:0;}
  .layui-tab{margin:0;}
</style>
<body> 
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <?php $form_widget = new \app\common\widget\FormPro(); $tinymce_num=0;  $tinymce_key=[]; ?>
      <form class="layui-form info_tj" method="post"  >
          <input type="hidden" name="id" value="{$data_res['id']|default=''}">
          <input type="hidden" name="cid" value="{$cid}">
          <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
              <li class="layui-this">基本设置</li>
              <li>扩展参数</li>
            </ul>
            <div class="layui-tab-content">
              <div class="layui-tab-item layui-show">
                <div class="layui-col-sm12">
                  <div class="layui-row layui-col-space15">
                      <div class="layui-col-sm<?php echo $m_res['is_two']==1?'9':'12'; ?>">
                        <div class="layui-card">
                        {include file="public/tpl_diy_url"}
                            <?php foreach($m_list as $k=>$vo){ if($vo['position']=='1'){ ?>
                          {include file="public/tpl_post"}
                          <?php }} ?>
                        </div>
                      </div>
                      <div class="layui-col-sm<?php echo $m_res['is_two']==1?'3':'12'; ?>">
                        <div class="layui-card">
                            <?php foreach($m_list as $k=>$vo){ if($vo['position']=='2'){ ?>
                          {include file="public/tpl_post"}
                          <?php }} ?>
                        </div> 
                        {include file="public/widget_submit"}


                      </div>
                  </div>
                </div>
              </div>
              <div class="layui-tab-item">
                <?php $res = $data_res;?>
                {include file="public/tpl_field_append"}
              </div>
            </div>
          </div>
      </form>
      </div>
    </div>
  </div>
  <script>
 layui.use(['form'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form;
    
    <?php if($tinymce_num>0){ ?>
        $(".tijiao").on("click",function(){
          var index = layer.load(2);
          var data = $(".info_tj input,.info_tj textarea,.info_tj select").serializeArray();    
          var z_data = {
            data:data, 
            <?php for($_tinymce_ii=0;$_tinymce_ii<$tinymce_num;$_tinymce_ii++){ ?>
              "{$tinymce_key[$_tinymce_ii]}@tinymce" : tinymce.editors[{$_tinymce_ii}].getContent(),   
            <?php } ?>
            editor_type:'tinymce' 
          }
          $.ajax({
              type:'post',
              url:"{:url('admin/category/post_add')}",
              data:z_data,
              dataType:'json',
              success:function(res){
                layer.close(index);
                if(res.result==1){
                  layer.msg(res.msg, {icon: 1});
                  setTimeout(function() {
                    window.parent.location.reload();
                  }, 2000);
                }else{
                  layer.msg(res.msg, {icon: 2});
                }
              }
          })
        });
      
    <?php }else{ ?>
      $(".tijiao").on("click",function(){
        var index = layer.load(2);
        var data = $(".info_tj input,.info_tj textarea,.info_tj select").serialize();      
        $.ajax({
            type:'post',
            url:"{:url('admin/category/post_add')}",
            data:data,
            dataType:'json',
            success:function(res){
              layer.close(index);
              if(res.result==1){
                layer.msg(res.msg, {icon: 1});
                setTimeout(function() {
                  window.parent.location.reload();
                }, 2000);
              }else{
                layer.msg(res.msg, {icon: 2});
                
              }
              
            }
        })
      });
    
    <?php } ?>


    // $(".tijiao").on("click",function(){
    //   // var index = layer.load(2);
    //   var data = $(".info_tj input,.info_tj textarea,.info_tj select").serialize();   
    //   var url = "{:url('admin/category/post_add')}"
    //   $.ajax({
    //       type:'post',
    //       url:url,
    //       data:data,
    //       dataType:'json',
    //       success:function(res){
    //         // layer.close(index);
    //         if(res.result==1){
    //           layer.msg(res.msg, {icon: 1});
    //           setTimeout(function() {
    //             window.parent.location.reload();
    //           }, 2000);
    //         }else{
    //           layer.msg(res.msg, {icon: 2});
    //         }
    //       }
    //   })
    // });
    
  });
 function deleteFile(obj) {
   $(obj).parent().remove();
  }
</script>

</body>
</html>
{:do_action('admin_js')}